<?php
class CustomerInfoDao extends CFormModel{
    public function getCustomers($params=array()){
        if (!array_key_exists('status', $params)){
            $params['status']=1;
        }
        if (!array_key_exists('count', $params)){
            $params['count']=1;    
        }
        
        $sql='
                SELECT cu.id,cb.bid_num 
                FROM customer as cu
                LEFT JOIN customer_bid_info as cb ON
                cu.id=cb.customer_id
                WHERE 
                    1 
                AND  cu.status='.$params["status"].'
                AND  cb.bid_num>0
            ';
        $limit=' limit '.$params['count'];
        $sql.=$limit;
        $customerList=Yii::app()->db->createCommand($sql)->queryAll();
        return $customerList;
    }
}